You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support nested skill discovery in skills directories - #1801
Skills can now be organized in category/organizational subdirectories under a skills root. Discovery walks the tree (bounded depth) and treats any directory containing a SKILL.md as a skill; the skill's identity comes from the directory that contains SKILL.md, not its parent category folders (which are purely organizational). Category folders need not match the skill-name regex.
sdk/src/skills/load-skills.ts: recursive discovery with bounded depth, skipping hidden/heavy dirs; skill dirs are not descended into.
packages/agent-runtime/src/tools/handlers/tool/skill.ts: mid-session disk lookup now searches nested category folders too.
Good instinct and the core logic (bounded-depth recursive walk, skip hidden/heavy dirs, identity from the SKILL.md-containing dir) is sound and matches the issue's intent. A few things to tighten before this is port-ready:
No new tests. This repo's existing load-skills tests presumably cover flat discovery; a nested-skill feature needs new test cases (nested category dirs, name collisions between nested skills, depth-limit behavior, hidden-dir skipping) in both sdk/src/skills/load-skills.test.ts and the skill handler tests. "Existing tests pass" isn't evidence the new code path works.
Silent name collisions.discoverSkillsFromDirectory merges nested results with Object.assign(skills, nested) — if two skills in different category folders share a name, one silently overwrites the other with no warning. Given identity is now decoupled from the full path, this seems likely to happen and deserves at least a verbose warning, matching existing behavior for invalid names.
skill.ts recursive lookup is O(n) full-tree walk per mid-session lookup, done via readdirSync/statSync on every call — for large skills directories this could be slow compared to the old direct path.join + stat. Worth a comment on expected scale, or caching.
Duplicate MAX_SKILL_NESTING_DEPTH/depth > 6 magic number logic exists in both files independently (skill.ts hardcodes 6 inline vs. the named constant in load-skills.ts) — consider sharing the constant to avoid drift.
Not close-worthy, the direction is right, but needs tests and the collision-handling question answered before a maintainer should port it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bot:triagedClassified by the community triage botpr:needs-workRight idea, not mergeable as written
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1784.
Skills can now be organized in category/organizational subdirectories under a skills root. Discovery walks the tree (bounded depth) and treats any directory containing a
SKILL.mdas a skill; the skill's identity comes from the directory that containsSKILL.md, not its parent category folders (which are purely organizational). Category folders need not match the skill-name regex.sdk/src/skills/load-skills.ts: recursive discovery with bounded depth, skipping hidden/heavy dirs; skill dirs are not descended into.packages/agent-runtime/src/tools/handlers/tool/skill.ts: mid-session disk lookup now searches nested category folders too.Tests: existing load-skills and skill handler tests pass (pre-existing platform failures unchanged).